package demo10;

public class OuterClass {
    public int data1 = 1;
    private int data2 = 2;
    public static int data3 = 3;

    public void test(){
        System.out.println("out::test方法");
    }
    //静态内部类
    static class InnerClass{
        public int data4 = 4;
        public static int data5 = 5;

        public void func(){
            System.out.println("InnerClass::func()");
            //外部类的非静态成员不可以在静态内部类中进行访问 ， 原因：静态的东西都是不依赖于对象的
            OuterClass outerClass = new OuterClass();
            System.out.println(outerClass.data1);
            System.out.println(outerClass.data2);

            System.out.println(data3);
            System.out.println(data4);
            System.out.println(data5);
        }

    }
}
